<template>
  <div class="index">
    <el-container style="height: 100%">
      <el-aside :class="someState ? 'notShow' : 'isShow'">
        <Aside></Aside>
      </el-aside>
      <el-main>
        <Main></Main>
      </el-main>
    </el-container>
  </div>
</template>
<script>
import Aside from "@/components/buju/Aside.vue";
import Main from "@/components/buju/Main.vue";
import { mapState } from "vuex";
export default {
  components: {
    Aside,
    Main,
  },
  computed: {
    // 使用 mapState 辅助函数来创建计算属性，这些属性会返回 store 中的状态
    ...mapState({
      // 映射 this.someState 为 store.state.someState
      someState: (state) => state.show,
    }),
  },
  watch: {
    someState(newVal, oldVal) {
      console.log(newVal, oldVal);
    },
  },
};
</script>
<style lang="less" scoped>
.index {
  height: 100vh;
  .el-header,
  .el-footer {
    background-color: white;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: white;
    color: #333;
    text-align: center;
  }

  .el-main {
    background-color: #e9eef3;
    color: #333;
    padding: 0;
  }

  body > .el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }

  .isShow {
    width: 180px !important;
    transition: width 0.4s; 
  }

  .notShow {
    width: 100px !important;
    transition: width 0.4s; 
  }
}
</style>